Class HCC.DT.HCC2HL72.OrderStatusUpdate Extends Ens.DataTransformDTL [ DependsOn = (EnsLib.EDI.XML.Document, EnsLib.HL7.Message) ]
{

Parameter IGNOREMISSINGSOURCE = 1;

Parameter REPORTERRORS = 1;

Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;

XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
<transform sourceClass='EnsLib.EDI.XML.Document' targetClass='EnsLib.HL7.Message' sourceDocType='POOR_IN200901UV:POOR_IN200901UV' targetDocType='2.5.1:MDM_T01' create='new' language='objectscript' >
<assign value='source.{id(1).extension}' property='target.{MSH:MessageControlID}' action='set' />
<assign value='source.{creationTime(1).value}' property='target.{MSH:DateTimeOfMessage.Time}' action='set' />
<assign value='"OMP"' property='target.{MSH:MessageType.MessageCode}' action='set' />
<assign value='"O09"' property='target.{MSH:MessageType.TriggerEvent}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().transcriber.time.any.value}' property='target.{EVN:EventOccurred.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().transcriber.assignedEntity().id.item().extension}' property='target.{EVN:OperatorID().IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup(1).transcriber.assignedEntity().choice.assignedPerson.name()})' property='target.{EVN:OperatorID().FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().location().serviceDeliveryLocation().serviceProviderOrganization.id().item().extension}' property='target.{ORCgrp().ORC:OrderingFacilityName().IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().location().serviceDeliveryLocation().serviceProviderOrganization.name})' property='target.{ORCgrp().ORC:OrderingFacilityName().OrganizationName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().time.value}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).EffectiveDate}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().id.item().extension}' property='target.{ORCgrp(1).ORC:VerifiedBy(1).IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().verifier().assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp(1).ORC:VerifiedBy(1).GivenName}' action='set' />
<assign value='"LAB"' property='target.{ORCgrp().ORC:OrderType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).id(1).item(2).extension}' property='target.{PV1:VisitNumber.IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).code.code}' property='target.{PV1:AdmissionType}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).code.code}' property='target.{PV1:PatientClass}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().location.id.item().extension}' property='target.{PV1:AssignedPatientLocation.Bed}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).location(1).serviceDeliveryLocation(1).location.asLocatedEntityPartOf(1).location(1).id.item(1).extension}' property='target.{PV1:AssignedPatientLocation.Room}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().componentOf1.encounter().location().serviceDeliveryLocation().serviceProviderOrganization.name})' property='target.{PV1:AssignedPatientLocation.Facility}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.placerGroup(1).effectiveTime},"&gt;")_"&gt;","//s:low/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).StartDateTime}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath($P(source.{controlActProcess(1).subject(1).choice.placerGroup(1).effectiveTime},"&gt;",2)_"&gt;","//s:high/@value")' property='target.{ORCgrp(1).ORC:QuantityTiming(1).EndDateTime}' action='set' />
<assign value='"2.5"' property='target.{MSH:VersionID}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.addr})' property='target.{PID:PatientAddress()}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).id.item(1).extension}' property='target.{PID:PatientID}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).extension}' property='target.{PID:PatientIdentifierList().IDNumber}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).component2(1).choice.observationRequest(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.id.item(1).root}' property='target.{PID:PatientIdentifierList().IdentifierTypeCode}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.administrativeGenderCode.code}' property='target.{PID:AdministrativeSex}' action='set' />
<assign value='source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.birthTime.value}' property='target.{PID:DateTimeofBirth}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess(1).subject(1).choice.placerGroup(1).componentOf1.encounter(1).subject(1).patient(1).choice.patientPerson.name})' property='target.{PID:PatientName()}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().id().item().extension}' property='target.{TXA:SetIDTXA}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().effectiveTime.validTimeLow}' property='target.{TXA:ActivityDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().code().code}' property='target.{TXA:PlacerOrderNumber().EntityIdentifier}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().code().displayName}' property='target.{TXA:PlacerOrderNumber().NamespaceID}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().component1().choice.processStep().code().displayName.value}' property='target.{ORCgrp().NTE():Comment()}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().specimen().choice.specimen().subjectOf1().choice.choice.specimenProcessStep().effectiveTime.any.value}' property='target.{ORCgrp().OBR:SpecimenReceivedDateTime.Time}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().specimen().choice.specimen().subjectOf1().choice.choice.specimenProcessStep().performer().choice.assignedEntity().id.item().extension}' property='target.{ORCgrp().OBR:CollectorIdentifier().IDNumber}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().specimen().choice.specimen().subjectOf1().choice.choice.specimenProcessStep().performer().choice.assignedEntity().choice.assignedPerson.name()})' property='target.{ORCgrp().OBR:CollectorIdentifier().FamilyName}' action='set' />
<assign value='source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().specimen().choice.specimen().id().extension}' property='target.{ORCgrp().OBR:SpecimenSource.SpecimenSourceNameorCode.Identifier}' action='set' />
<assign value='##class(HCC.Utils.Functions).GetDataByXPath(source.{controlActProcess().subject().choice.placerGroup().component2().choice.observationRequest().reason().choice.choice.observation().value})' property='target.{TXA:DocumentChangeReason}' action='set' />
</transform>
}

}
